# REPLICATION
# Place-Based Campaigning: The Political Impact of Real Grassroots Mobilization
# Daniel Bischof and Thomas Kurer
# Journal of Politics

# Master File to run three files for data preparation
# Produce Figures and Tables created in R (Fig 1, Fig 3, Fig A1, Table A1)

# Preparation
dev.off()
cat("\014")  
# globals
options(scipen=999)


setwd("./code/do")

# packages
if (!require("pacman")) install.packages("pacman") 

pacman::p_load(RColorBrewer, transformr, zoo, mapview, ggmap, tidyverse, broom, hrbrthemes, plm, estimatr, sandwich, lmtest, AER, lfe, huxtable, margins, readstata13, texreg, xtable, reshape2, 
               readxl, readtext, quanteda, pdftools, stringi, lubridate, sp, maptools, rgeos, rgdal, spdep, sf)


sf::sf_use_s2(FALSE)


dev.set(dev.next())
dev.set(dev.next())
dev.set(dev.next())

source("01_spatial_aggregation_meetup.R")

dev.set(dev.next())
dev.set(dev.next())
dev.set(dev.next())

source("02_create_maindata.R")

dev.set(dev.next())
dev.set(dev.next())
dev.set(dev.next())

source("03_extend_maindata.R")

dev.set(dev.next())
dev.set(dev.next())
dev.set(dev.next())

source("04_R_figures.R")

